<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>登录成功</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	
  </head>
  
  <body>
    <h3 align="center">产品列表</h1><br><br>
    
    <div align="center">
		<span>
			共 ${productNum} 个商品 &nbsp;&nbsp;当前第 ${page}页 &nbsp;&nbsp;&nbsp;<br>
			<a href="adminHandle/productList2?page=${page-1}" onClick="return last(${page})">上一页</a>&nbsp;
		<span>
		<c:set var="p" value="${pageCount}"/>
		<c:forEach var="num" begin="1" end="${p}" step="1">
			<c:if test="${ num==p}">
				<a href="adminHandle/productList2?page=${num}">	${num}</a>
			</c:if>
			<c:if test="${ num<p}">
				<a href="adminHandle/productList2?page=${num}">	${num}</a>
				、
			</c:if>
		</c:forEach> 
		</span>
			<a href="adminHandle/productList2?page=${page+1}" onClick="return next(${page},${pageCount})"> &nbsp;下一页</a>
		</span>
	</div><br><br><br>
    
    <table width="70%" align="center" >
    	<tr>
    		<td>产品编号</td>
    		<td>产品名</td>
    		<td>产品类别</td>
    		<td>销售额</td>
    		<td>利润</td>
    		<td>客户数量</td>
    		
    	</tr>
    	<c:forEach items="${productListExtensions}" var="bean">
    	<tr>
    		<td>${bean.product.id} </td>
    		<td><a href="adminHandle/productBuyDetail?id=${bean.product.id}">${bean.product.productName}</a></td>
    		<td>${bean.product.category} </td>
    		<td>${bean.ccost}</td>
    		<td>${bean.profit}</td>
    		<td>${bean.ucount}</td>
    	</tr>
    	</c:forEach>
    	
    	
    	<tr>
    		<td colspan="7" align="center"> ${errMsg } </td>
    	</tr>
    </table>
    <input type="hidden" value="${page}" id="page">
	<input type="hidden" value="${productNum}" id="productNum">
<script type="text/javascript">
	
	function last(pages){
		var page=pages;
		if(page==1){
			alert("已经是第一页了");
			return false;
		}
		return true;
	}
	function next(pages,pageCounts){
		var pageCount=pageCounts;
		var page=pages;
		if(page>=pageCount){
				alert("已经是最后一页了");
				return false;
		}
		return true;
	}
</script>
  </body>
</html>
